package com.example.testanything;

import java.util.ArrayList;
import java.util.regex.Pattern;

public class LongToString {
	
	private ArrayList<Integer> DigtalLib = new  ArrayList<Integer>();
	String rex = "[0-9]";
	private ArrayList<String> StringLib  = new  ArrayList<String>();
	private long Number =0;
	LongToString (String Int){
		char[] tem = Int.toCharArray();
		for (char c : tem){
			String cc = String.valueOf(c);
			boolean If = cc.matches(this.rex);
			if (If == true){
				int ccc = Integer.valueOf(cc);
				DigtalLib.add(ccc);
			}
		}
		
		for (int i : DigtalLib){
			System.out.println(i);
		}
	}
	
	public void Deal_addition(){
		
		int length = this.DigtalLib.size();
		System.out.println("length : "+length);
		for (int i = 0 ;i < length ;i++){
			this.Number += this.DigtalLib.get(i) * this.TenSub(this.DigtalLib.size()-i);
		}
	}
	
	
	//iner for to calculate each Integer's power
	public long TenSub(int dig){
		long num = 1;
		int count = dig;
		while (count > 1){
			count = count-1;
			num = num * 10;	
		}
		System.out.println("now : "+num);
		return num;
	}
	
	
	
	public long getInteger(){
		this.Deal_addition();
		return this.Number;
	}
}
